<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        canvas{
            border:1px solid #ccc ;
			margin-right:50px;
			width:200px;
			height:200px;
        }
    </style>
</head>
<body>
    <script>
		const base64 = '' ;
         (() => {
        const canvas = document.createElement("canvas");
        canvas.width = 400;
        canvas.height = 400;
        document.body.append(canvas);

        const ctx = canvas.getContext('2d');

        const img = new Image();
        img.src =base64;
        img.onload = function(){

          let i = 0 ;
          function show(){
            ctx.clearRect(0,0,400,400);
            ctx.drawImage(img ,i*94,0,94,img.height , 0,0,94,img.height);
            i++ ;
            if(i == 5){
              i = 0 ;
            }
          }
          setInterval(show,100);

        }
        
      })();

      (() => {
        const canvas = document.createElement("canvas");
        canvas.width = 400;
        canvas.height = 400;
        document.body.append(canvas);

        const ctx = canvas.getContext('2d');

        const img = new Image();
        img.src = base64;
        img.onload = function(){

          let i = 0 ;
          let j = 0 ;
          function show(){
            ctx.clearRect(0,0,400,400);
            ctx.drawImage(img ,i*94,0,94,img.height , j*10,0,94,img.height);
            i++ ;
            j++ ;
            if(i == 5){
              i = 0 ;
            }
            if(j*10 >=canvas.width){
               j = 0 ; 
            }
          }
          setInterval(show,100);

        }
        
      })();

    </script>
</body>
</html>